//
//  OneLabelCellData.m
//  18Birdies
//
//  Created by 冯琦帆 on 16/1/18.
//  Copyright © 2016年 Lc. All rights reserved.
//

#import "OneLabelCell.h"
#import "OneLabelCellData.h"

@implementation OneLabelCellData

+ (instancetype)cellDataWithTitle:(NSString*)title {
  return [self cellDataWithTitle:title height:30];
}

+ (instancetype)cellDataWithTitle:(NSString*)title height:(CGFloat)height {
  OneLabelCellData* cellData = [[OneLabelCellData alloc] init];
  cellData->_title = title;
  cellData.labelFont = [LcFont gm14];
  cellData.cellHeight = height;
  cellData.numberOfLines = 0;
  cellData.canHide = YES;
  return cellData;
}

+ (instancetype)cellDataWithTitle:(NSString*)title
                           height:(CGFloat)height
                    indicateImage:(UIImage*)indicateImage
           indicateClickedHnadler:(OnClickedHandler)indicateClickedHnadler {
  OneLabelCellData* cellData = [OneLabelCellData cellDataWithTitle:title height:height];
  cellData.indicateImage = indicateImage;
  cellData.indicateClickedHnadler = indicateClickedHnadler;
  return cellData;
}

- (Class)cellClazz {
  return OneLabelCell.class;
}

- (NSString*)nibName {
  return @"OneLabelCell";
}

- (void)refreshCell:(OneLabelCell*)cell {
  [super refreshCell:cell];
  cell.label.text = self.title;
  [cell.label setLcFont:self.labelFont];
  cell.label.numberOfLines = self.numberOfLines;
  cell.cellHeight = self.cellHeight;

  if (self.cellBackgroundColor != nil) {
    cell.backgroundColor = self.cellBackgroundColor;
  }

  cell.indicateImageView.image = self.indicateImage;
  cell.indicateImageView.hidden = self.indicateImage == nil;
  cell.indicateButton.hidden = cell.indicateImageView.hidden;
  cell.indicateClickedHnadler = self.indicateClickedHnadler;
  if (self.bottomPadding > 0) {
    cell.bottomConstraint.constant = self.bottomPadding;
  }
}

@end
